package com.xunai.saas.example.service.impl;

import com.xunai.saas.example.model.enums.CorporeityDiagnoseEnum;
import com.xunai.saas.example.model.param.AddTongueRecordParam;
import com.xunai.saas.example.model.param.CorporeityDiagnoseHandleParam;
import com.xunai.saas.example.model.param.CorporeityDiagnoseStartParam;
import com.xunai.saas.example.service.CorporeityDiagnoseService;
import com.xunai.saas.example.utils.HttpClientUtils;
import org.springframework.stereotype.Service;

@Service
public class CorporeityDiagnoseServiceImpl extends HttpClientUtils implements CorporeityDiagnoseService {

    @Override
    public String start(CorporeityDiagnoseStartParam corporeityDiagnoseStartParam) {
        return sendPost(CorporeityDiagnoseEnum.start.getUrl(), corporeityDiagnoseStartParam);
    }

    @Override
    public String handle(CorporeityDiagnoseHandleParam corporeityDiagnoseHandleParam) {
        return sendPost(CorporeityDiagnoseEnum.handle.getUrl(), corporeityDiagnoseHandleParam);
    }

    @Override
    public String addTongueRecord(AddTongueRecordParam addTongueRecordParam) {
        return sendPost(CorporeityDiagnoseEnum.addTongueRecord.getUrl(), addTongueRecordParam);
    }

    @Override
    public String result(String recordNo) {
        String url = String.format(CorporeityDiagnoseEnum.result.getUrl(), recordNo);
        return sendGet(url);
    }
}
